'''
Powered By CS2_Summer
此软件用于保护个人隐私、维护合法权益
软件基于Python3.9.0制作，使用时不断监听文件夹内容，可能会影响CPU性能，慎用！
实现原理：监听U盘内的文件夹是否存在，若存在 调用修改器将*.PNG全部改为*.TXT
*.TXT后加入随机数值，再改为*.PNG
'''
logrecord = []
import movefile as mvf
import os
import time
from file_fiddler import fiddler as fidlr
from device_listen import listener as ln

def rcdLog(a):
    logrecord.append(a)
    f = open("log.txt",'w')
    d= ''
    for i in logrecord:
        d = d + i + "\n"
    f.write(d)
    f.close()
    print("[LOGRECORD]日志已保存" + time.asctime(time.localtime(time.time())))
def mainapp():
    k = False
    while not k:
        k = ln.start()
        print("[LISTENING]正在监听F:\\表情包" + time.asctime( time.localtime(time.time()) ))
        rcdLog("[LISTENING]正在监听F:\\表情包" + time.asctime( time.localtime(time.time()) ))
        print("[RETURN]未检测到F:\\表情包" + time.asctime( time.localtime(time.time()) ))
        rcdLog("[RETURN]未检测到F:\\表情包" + time.asctime( time.localtime(time.time()) ))
        time.sleep(1)
    print("[SUCCESS]已检测到F:\\表情包" + time.asctime( time.localtime(time.time()) ))
    rcdLog("[SUCCESS]已检测到F:\\表情包" + time.asctime( time.localtime(time.time()) ))
    os.system("color A4 && cls")
    print("[SYSTEM]正在启动反制程序！")
    bL = fidlr.fidL()
    if(bL):
        mvf.MVF()
        print("[SUCCESS]反制成功！" + time.asctime( time.localtime(time.time()) ))
        rcdLog("[SUCCESS]反制成功！" + time.asctime( time.localtime(time.time()) ))
        quit("success")
if __name__ == "__main__":
    q = input("是否开始(Y/N):")
    if q == 'Y' or q == 'y':
        mainapp()
    else:
        quit("Process-interrupted-by-user|M01")


